Basic Auth + LDAP
2012/06/11 |
Configure httpd and set a page that people must authenticate and the authentication is from LDAP server.
Therefore it's necessarry to run LDAP server in your LAN.
|
|
[1] | It needs 'mod_authnz_ldap7 module, but it's loaded by default. If your httpd does not load it, add following lines in your httpd.conf. LoadModule ldap_module modules/mod_ldap.so LoadModule authnz_ldap_module modules/mod_authnz_ldap.so Following example shows 'test' directory requires an authentication. |
[root@www ~]#
vi /etc/httpd/conf.d/auth_ldap.conf # create new <IfModule authnz_ldap_module> <Directory /var/www/html/ldap> SSLRequireSSL AuthName "LDAP Authentication" AuthType Basic AuthBasicProvider ldap AuthLDAPURL ldap://10.0.0.100/dc=srv,dc=world?uid?sub?(objectClass=*) Require ldap-filter objectClass=posixAccount </Directory> </IfModule> systemctl restart httpd.service |
<html> <body> <div style="width: 100%; font-size: 40px; font-weight: bold; text-align: center;"> Test Page for LDAP Auth </div> </body> </html>
Access to the test page with web browser, then authentication is required as a config. Input a LDAP user and authenticate here. |
Just accessed. |